<?php
require(dirname(__FILE__)."/includes/init.php");
$arr = array('0' => 'updateEmail', );
$action = '';
$action = isset($_REQUEST['action'])?$_REQUEST['action']:'';
if (isset($action)) {
	if (in_array($action, $arr)) {
		if ($action == "updateEmail") {
			try{
				$preEmail = addslashes($_REQUEST['preEmail']);
				$emailId = addslashes($_REQUEST['emailId']);
				$nowEmail = addslashes($_REQUEST['nowEmail']);
				$name = addslashes($_REQUEST['name']);
				$timeStamp = addslashes($_REQUEST['timeStamp']);
				$userBrowser = addslashes($_REQUEST['userBrowser']);
				$ip = addslashes($_REQUEST['ip']);
				if ($timeStamp == 0) {
					$timeStamp = time();
				}
				if ($ip == 0) {
					$ip = get_onlineip();
				}
				if ($userBrowser == 0) {
					$userBrowser = getBrowserVersion();
				}												
				$sql = "insert into updateEmail(preAddress, nowAddress, name, emailId, timeStamp, userBrowser, userIp) values('".$preEmail."','".$nowEmail."','".$name."','".$emailId."','".$timeStamp."','".$userBrowser."','".$ip."')";
				$GLOBALS['db']->dbquery($sql);
                echo "subscribe successful,we will redirect you to our website after 3 seconds... ";
                sleep(3);
                header('Location:$dealUrl');

			}catch(Exception $e){
				echo $e->getMessage();
			}

		}
	}
}
?>